# 使用地理编码服务API
import requests
import json

amap_api_key = "803861c34e31752fb8c5863ba3aa62b4"
# 将地址转换为经纬度
url = f"http://restapi.amap.com/v5/place/text?key={amap_api_key}&keywords=北安路&types=050100&region=锦州市"
response = requests.get(url)
data = json.loads(response.text)
# print(data)
pois=data['pois']
for pois in pois:
    name = pois['name']
    location = pois['location']
    print("商铺名称:" + name + ", 经纬度:" + location)